﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Xml.Linq;
using FlickrXplorer.Web.Objects;
using System.Text;
using FlickrXplorer.Web.Plugin;

// DEMO 1
namespace MyFlickrXplorerPlugins
{
  public class PictureInfo : FlickrXplorerPlugin
  {
    public PictureInfo() : base("Picture Info")
    {
      this.LoadMainPhoto += new EventHandler<LoadMainPhotoEventArgs>(PictureInfo_LoadMainPhoto);
    }

    private void PictureInfo_LoadMainPhoto(object sender, LoadMainPhotoEventArgs e)
    {
      StringBuilder builder = new StringBuilder();
      builder.AppendFormat("<h3>Information about photo {0}</h3>", e.PhotoDetail.Id);
      builder.Append("<ul>");
      builder.AppendFormat("<li>Title <em>{0}</em></li>", e.PhotoDetail.Title);
      builder.AppendFormat("<li>Submitted by <em>{0}</em></li>", e.PhotoDetail.Username);
      builder.AppendFormat("<li><a href='{0}' title='{0}'>Link to original photo</a></li>", e.PhotoDetail.Url);
      builder.Append("</ul>");
      e.Content = builder.ToString();
    }
  }
}
